/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package serverCommunication.model;

/**
 *
 * @author RodriguesMoises
 */
public class Image{
    private int indexInArray;
    private byte[] image;
    
    public byte[] getImage() {
        return image;
    }

    public String getImageAsString(){
        if(image != null)
        {
            char[] string = new char[image.length*3];
            string[0] = '[';
            for (int i = 0; i < image.length - 1; i++) {
                string[i*3 + 1] = (char)image[i];
                string[i*3 + 2] = ',';
                string[i*3 + 3] = ' ';
            }
            string[image.length*3 - 2] = (char)image[image.length - 1];
            string[image.length*3 - 1] = ']';
            String ret = new String(string);
            return ret;
        }
        return "[]";
    }
    
    public void setImage(byte[] image) {
        this.image = image;
    }

    public int getIndexInArray() {
        return indexInArray;
    }

    public void setIndexInArray(int indexInArray) {
        this.indexInArray = indexInArray;
    }

    @Override
    public String toString() {
        return "|Image{" + "indexInArray=" + indexInArray + ",| image=" + getImageAsString() + "}Image|";
    }
}
